#!/bin/bash
echo "Running AI System with proper PATH..."
echo

WXWIN="/d/vc/wxWidgets-3.2.7"

# 设置 PATH
export PATH="$WXWIN/lib:$PATH"

if [[ ! -f "cbp2make_ai.exe" ]]; then
    echo "❌ Executable not found: cbp2make_ai.exe"
    echo "Please build first using: ./build_with_path.sh"
    exit 1
fi

# 检查 DLL 可访问性
if [[ ! -f "$WXWIN/lib/wxbase32u_gcc_custom.dll" ]]; then
    echo "❌ Missing DLL: $WXWIN/lib/wxbase32u_gcc_custom.dll"
    exit 1
fi

if [[ ! -f "$WXWIN/lib/wxmsw32u_core_gcc_custom.dll" ]]; then
    echo "❌ Missing DLL: $WXWIN/lib/wxmsw32u_core_gcc_custom.dll"
    exit 1
fi

echo "✅ DLLs are accessible via PATH"
echo "🚀 Starting AI System..."

# 运行程序
if [[ "$1" == "--interactive" ]]; then
    ./cbp2make_ai.exe --interactive
elif [[ "$1" == "--status" ]]; then
    ./cbp2make_ai.exe --status
else
    ./cbp2make_ai.exe --help
fi
